<?php
namespace app\serveradv\service\adv;
use app\manage\service\ApiBase;
/**
 * Created by PhpStorm.
 * User: 蒋哲
 * Date: 2017/7/15
 * Time: 15:13
 * 广告位分类
 */
class AdvClassify extends ApiBase
{
    protected $advClassifyLogic = 'app\serveradv\logic\AdvClassify';
    protected $advClassifyValidate = 'app\serveradv\validate\AdvClassify';

    //添加广告位分类
    public function addAdvClassify(): array
    {
        $data = $this->issetReceiveData(["name"=>"", "app_id"=>"", "other_app_read"=>" ", "is_public"=>0, "action"=>"",
            "pid"=>0, "order"=>0, "description"=>" ", "status"=>1, "add_user_id"=>""]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/add','addAdvClassify');
    }

    //获取全部广告位分类 树状
    public function gainAdvClassifyList(): array
    {
        $data = $this->haveIssetReceiveData([]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifyList','gainAdvClassifyList');
    }

    //某条广告位分类编辑(修改)
    public function editAdvClassify(): array
    {
        $data = $this->issetReceiveData(["id" => " ", "name" => "", "app_id" => "", "other_app_read" => " ",
            "is_public" => 0, "action" => "", "pid" => 0, "order" => 0, "description" => " ", "status" => "1",
            "add_user_id" => ""]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/edit','editAdvClassify');
    }

    //启用某个分类广告位分类
    public function enableAdvClassify(): array
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifyEnable','enableAdvClassify');
    }

    //禁用某个分类广告位分类
    public function disableAdvClassify(): array
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifyDisable','disableAdvClassify');
    }

    //删除某一广告位分类
    public function deleteAdvClassify(): array
    {
        $data = $this->haveIssetReceiveData(["id" => " "]);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifyDelete','deleteAdvClassify');
    }

    //某一类广告位分类列表获取
    public function advClassifySomeList(): array
    {
        $data = $this->haveIssetReceiveData(['pid' => ' ', 'app_id' => '']);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifySomeList','advClassifySomeList');
    }

    //不同条件广告位分类列表获取 非删除 分类名称 描述
    public function advClassifyCondition(): array
    {
        $data = $this->haveIssetReceiveData(['keywords' => '', 'page' => ' ', 'listRows' => ' ']);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifyCondition','advClassifyCondition');
    }

    //获取某一广告位分类详情
    public function classifyInfo(): array
    {
        $data = $this->issetReceiveData(['id' => '']);
        return $this->oneStepRun($data,'serveradv/adv/ApiAdvClassify/classifyInfo','editAdvClassify');
    }
}